# coding:utf-8
"""
栈
2022年12月12日15:15:42
"""
from single_link_list import SingleLinkList

class Stack():
    def __init__(self,item = None):
        self.__list = SingleLinkList()
        if item != None:
            self.push(item)
    def push(self,item):
        """从尾部添加"""
        self.__list.append(item)
        
    def pop(self):
        """从尾部弹出"""
        return self.__list.remove(-1)
    
    def is_empty(self):
        return self.__list.is_empty()
        

    def size(self):
        return self.__list.length()


if __name__ == "__main__":
    s = Stack()
    s.push(1)
    s.push(2)
    s.push(3)
    print(s.pop())
    print(s.pop())
    print(s.pop())
    print(s.size())
